Skip to content

fix: create the Gitee release for a new version instead of crashing - #250

Open
yujiezhang-ops wants to merge 1 commit into
mainfrom
claude/gitee-sync-new-release
Open

yujiezhang-ops wants to merge 1 commit into
mainfrom
claude/gitee-sync-new-release

Conversation

@yujiezhang-ops

Copy link
Copy Markdown
Collaborator

Summary

The Gitee sync for v0.8.6 failed (run 36236699168) with AttributeError: 'Request' object has no attribute 'method'. Two bugs stacked:

  • Gitee returns null, not 404, for a tag without a release. GET /api/v5/repos/maimory/BootAgent/releases/tags/v0.8.6 answers HTTP 200 with body null (checked directly; v9.9.9 does the same). gitee_release only treated 404 as "no release yet", so the first sync of any new version fell into the non-object error path. Earlier successful runs only re-synced the already-existing v0.8.5.
  • That error path crashed. urllib.request.Request only sets .method when one is passed explicitly, so building the message raised AttributeError. All three messages now use get_method().

request_json is split so gitee_release can read a null body (read_json) while other callers still require an object.

Gitee already mirrors main at 8890920 and tag v0.8.6, so creating the release against target_commitish: main is safe.

Test plan

  • New unit tests: null → missing, 404 → missing, existing release returned, non-object response raises RuntimeError naming GET <url> instead of AttributeError
  • python -m unittest scripts.test_sync_gitee_ota_release scripts.test_retain_gitee_release_line: 12 passed
  • Read-only check against live Gitee: gitee_release(..., "v0.8.6") → None, v0.8.5 → release 1132764 with its OTA assets
  • After merge: re-run "Sync Releases to Gitee" with version=v0.8.6

🤖 Generated with Claude Code

Gitee answers GET releases/tags/<tag> for a tag with no release as HTTP 200
and a literal `null`, not 404, so the first sync of v0.8.6 hit the
non-object branch. That branch then crashed on request.method, which
urllib's Request only sets when a method is passed explicitly. Earlier
successful runs only ever re-synced an existing release.

Treat `null` as "no release yet" and report the method via get_method().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@yujiezhang-ops
yujiezhang-ops requested a review from a team September 26, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants